import java.util.Scanner;

public class Main {

    //棋盘
    //有一个 n * n 的棋盘
    //进行 m 次操作
    //一开始棋盘默认为白色(0)
    //操作一次子矩阵中的元素颜色取反，变黑色(1)
    //最后输出整个矩阵
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[][] sum = new int[n + 2][n + 2];
        for (int i = 1; i <= m; i++) {
            int x1 = scan.nextInt();
            int y1 = scan.nextInt();
            int x2 = scan.nextInt();
            int y2 = scan.nextInt();
            sum[x1][y1] ^= 1;
            sum[x2 + 1][y2 + 1] ^= 1;
            sum[x2 + 1][y1] ^= 1;
            sum[x1][y2 + 1] ^= 1;
        }

        for (int i = 1; i <= n ; i++) {
            //横向前缀和
            for (int j = 1; j <= n ; j++) {
                sum[i][j] ^= sum[i][j - 1]; 
            }
            //纵向前缀和
            for (int j = 1; j <= n ; j++) {
                sum[i][j] ^= sum[i - 1][j];
            }
        }

        for (int i = 1; i <= n ; i++) {
            for (int j = 1; j <= n ; j++) {
                System.out.print(sum[i][j]);
            }
            System.out.println();
        }
    }

    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        // 初始化二维差分数组，尺寸为(n+2)x(n+2)
        int[][] sum = new int[n+2][n+2];

        // 处理m次矩形区域的差分标记
        for (int k = 0; k < m; k++) {
            int x1 = scanner.nextInt();
            int y1 = scanner.nextInt();
            int x2 = scanner.nextInt();
            int y2 = scanner.nextInt();
            // 二维差分标记的四个角操作
            // 1^0 = 1 , 1^1 = 0
            sum[x1][y1] ^= 1;
            sum[x2+1][y2+1] ^= 1;
            sum[x1][y2+1] ^= 1;
            sum[x2+1][y1] ^= 1;
        }

        // 两次前缀异或计算得到最终矩阵
        for (int i = 1; i <= n; i++) {
            // 横向异或前缀
            for (int j = 1; j <= n; j++) {
                sum[i][j] ^= sum[i][j-1];
            }
            // 纵向异或前缀
            for (int j = 1; j <= n; j++) {
                sum[i][j] ^= sum[i-1][j];
            }
        }

        // 输出结果矩阵
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                System.out.print(sum[i][j]);
            }
            System.out.println();
        }
    }
}
